#!/usr/bin/env python
import random
import re, math
import sys
import getopt
import datetime
import time
import numpy as np
import urllib
from profilehooks import profile

from scipy.linalg import eigh
from scipy.sparse.linalg import eigsh

h2 = 3
m = 7
base = 1000000
i = 0
p = 8
pi = 5

@profile
def modulocalc() : 
	for x in range (i) :
		c = (x + h2) % m

@profile
def refactor() :
	for x in range(i)	 :
		c = (p + pi - 5) & (p-1)
		

for j in range (1,4) :
	i = int(math.pow(2, j * 2) * base)
	modulocalc()
	refactor()
sys.exit(-1)

a =  np.mat([[2, 1], [2, 0]])
b = np.mat([[2, 1], [1, 0]])
print (a* b)


print (np.cumsum(a))

np.set_printoptions(suppress=True)

np.random.seed(0)
X = np.random.random((100,100)) - 0.5
X = np.dot(X, X.T) #create a symmetric matrix
print (X)
evals_all, evecs_all = eigh(X)
evals_large, evecs_large = eigsh(X, 3, which='LM')
print (evals_all[-3:])
print (evals_large)
print (np.dot(evecs_large.T, evecs_all[:,-3:]))

out.write(str(evals_large))
out.write('\n')
np.savetxt(out, evals_large)

out.close()